1 package jrre.api.java.lang.reflect;
2
3 import jrre.classloader.classfile.access_flags.*;
4 import jrre.classloader.classfile.attributes.*;
5
6 public class MethodEntry {
7
8 private MethodAccessFlags accessFlags;
9 private int nameIndex, descriptorIndex, attributesCount;
10 private Attributes attributes;
11 private String className;
12 private String name;
13 private String descriptor;
14
15 public MethodEntry(){
16
17 }
18
19 /***
20 * Gets the ClassName.
21 */
22 public String getClassName(){
23 return this.className;
24 }
25
26 /***
27 * Sets the ClassName.
28 * @param ClassName The value to set it to.
29 */
30 public void setClassName(String className){
31 this.className = className;
32 }
33
34 public MethodEntry(MethodAccessFlags accessFlags,
35 int nameIndex,
36 int descriptorIndex,
37 int attributesCount,
38 Attributes attributes){
39
40 this.accessFlags = accessFlags;
41 this.nameIndex = nameIndex;
42 this.descriptorIndex = descriptorIndex;
43 this.attributesCount = attributesCount;
44 this.attributes = attributes;
45 }
46
47 public void setDescriptor(String descriptor){
48 this.descriptor = descriptor;
49 }
50
51 public String getDescriptor(){
52 return descriptor;
53 }
54
55 public void setName(String name){
56 this.name = name;
57 }
58 public String getName(){ return name; }
59
60 public String getFullyQualifiedName(){
61 return name + descriptor;
62 }
63
64 public jrre.StackFrame getStackFrame(){
65
66 CodeAttribute codeAttribute = attributes.getCodeAttribute();
67 jrre.StackFrame stackFrame = codeAttribute.getStackFrame();
68
69 stackFrame.setClassContainingMethod(jrre.MethodArea.getClass(className));
70
71 return stackFrame;
72 }
73
74 public MethodAccessFlags getMethodAccessFlags(){return accessFlags;}
75 public int getNameIndex(){return nameIndex;}
76 public int getDescriptorIndex(){return descriptorIndex;}
77 public int getAttributesCount(){return attributesCount;}
78 public Attributes getAttributes(){return attributes;}
79
80 public String toString(){
81 StringBuffer toReturn = new StringBuffer();
82 toReturn.append("\nMethodEntry: "+name);
83 toReturn.append("\n\tName Index: " + nameIndex);
84 toReturn.append("\n\tDescriptor Index: " + descriptorIndex);
85 toReturn.append("\n\t" + accessFlags.toString());
86 toReturn.append("\n\tAttributes Count: " + attributesCount);
87
88 /*
89 if(attributesCount > 0)
90 toReturn.append("\n\n\t" + attributes.toString());
91 */
92
93 if(!accessFlags.isNative())
94 toReturn.append("\n"+getStackFrame().toString());
95
96 return toReturn.toString();
97 }
98
99 }
100
This page was automatically generated by Maven